Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed typings for event handlers on the DBLWebhook class #26

Merged
merged 1 commit into from
Aug 10, 2020
Merged

Fixed typings for event handlers on the DBLWebhook class #26

merged 1 commit into from
Aug 10, 2020

Conversation

zihadmahiuddin
Copy link
Contributor

No description provided.

@tonkku107
Copy link
Contributor

What exactly is being "fixed" here?

@zihadmahiuddin
Copy link
Contributor Author

When using dblapi.js in a TypeScript project, the typing mess things up.
With the following code, I get these errors Property 'hostname' does not exist on type 'string', Property 'port' does not exist on type 'string' and Property 'path' does not exist on type 'string'.

dbl.webhook.on("ready", (hook) => {
  console.log(
    `Webhook running at https://${hook.hostname}:${hook.port}${hook.path}`
  );
});

This is because the typing file says that the callback function's signature should be like this:

(hostname: string, port: number, path: string) => void

which is not correct. The correct signature is something like this:

({hostname: string, port: number, path: string}) => void

Same thing for the vote event. I fixed the typing file so now it doesn't report any error in TypeScript projects.

@tonkku107
Copy link
Contributor

Alright, looks good to me but I am not a typescript user.

tonkku107
tonkku107 previously approved these changes Jul 3, 2020
@zihadmahiuddin
Copy link
Contributor Author

Sorry, I forgot to sign commits last time. So I had to commit again.

@tonkku107 tonkku107 merged commit ec89fe4 into Top-gg-Community:master Aug 10, 2020
@succubus86
Copy link

You rock

Copy link

@succubus86 succubus86 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ty

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants